package com.lsm.sm.action;


import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.lsm.sm.service.ManagerService;
import com.lsm.sm.util.Const;
import com.lsm.sm.util.WebUtil;

@Controller("managerAction")
@Scope("prototype")
public class ManagerAction{
	//private List<CoursePetition> cps = new ArrayList<CoursePetition>(); 
	private int type;
	private String course;
	private int schedule = 1;
	private String message;
	
	@Resource
	private ManagerService managerService;
	
	public String initialize(){
		return Const.RST_INIT;
	}
	
	public String deployCourse(){
		try{
			managerService.deployCourse( type, course, schedule );
			setMessage( WebUtil.dealRespsMsg( Const.RSPS_MSG_007 ) );
		}catch (Exception e) {
			setMessage( WebUtil.dealException( e ) );
		}
		
		return Const.RST_DEPLOYCOS;
	}
	
	public String checkPetition(){
		
		return Const.RST_PETITION;
	}
	
	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getCourse() {
		return course;
	}

	public void setCourse(String course) {
		this.course = course;
	}

	public int getSchedule() {
		return schedule;
	}

	public void setSchedule(int schedule) {
		this.schedule = schedule;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
}
